package com.yejing.redisdemoTest;

import lombok.extern.slf4j.Slf4j;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.DefaultJedisClientConfig;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;

@Slf4j
public class LogDemo {

    public Jedis jedis = null;

    @Before
    public void init() {
        if(null == jedis){
            DefaultJedisClientConfig config =
                    DefaultJedisClientConfig.builder() //
                            .password("123456") //
                            .build(); //
            HostAndPort hostPort = new HostAndPort("43.136.67.62", 6379);
            jedis = new Jedis(hostPort, config);
        }
    }


    @Test
    public void testPFAdd(){

        long pfadd = jedis.pfadd("login", "a1", "b1", "a2", "a3", "a2");

        log.info(pfadd+"");

        long login = jedis.pfcount("login");
        log.info(login+"");
    }


    @After
    public void end() {
        jedis.close();
    }
}
